-- corriosion
-- created by wangy
-- 腐蚀

return {
    apply = function(prop, baseValue)

        -- 威力
        if baseValue <= 1 then
            return baseValue;
        else
            return baseValue - math.max(1, math.modf(baseValue * tonumber(prop[2]) / 1000));
        end
    end,

    -- 每回合触发
    trigger = function(who, prop, arg)
        -- 腐蚀伤害
        local damage = prop[3];

        return CombatM.receiveDamage(who, who, damage, 0);
    end,

    desc = function(prop)
        local row = PropM.getRow(prop[1]);
        local desc = row.desc;

        local force = prop[2] / 10;
        local damage = prop[3];
        
        -- 降攻固定50%
        desc = string.gsub(desc, "{0}", force .. "%%");
        desc = string.gsub(desc, "{1}", damage);

        return desc;
    end,

    record = function(target, prop, path)
        return false;
    end
};